对于linux的进站白名单ip和端口的配置 | 您所在的位置:网站首页 › linux 防火墙 设置 › 对于linux的进站白名单ip和端口的配置 |
环境: uname -a(命令) : Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux more /etc/redhat-release(命令): CentOS Linux release 7.5.1804 (Core) 配置iptables防火墙的进站ip白名单和端口 1.确定是否启动了firewall 和iptables如下是firewall的部分命令 1、重启、关闭、开启firewalld.service服务 service firewalld restart 重启 service firewalld start 开启 service firewalld stop 关闭2、查看firewall服务状态 systemctl status firewall3、查看firewall的状态 firewall-cmd --state如果firewall是启动的 需要关闭掉 2.修改iptables的规则(首先需要确定是不是有iptables服务)如果没有规则 需要安装: 1.安装iptables防火墙 yum install iptables-services #安装2.编辑iptables防火墙配置 vi /etc/sysconfig/iptables #编辑防火墙配置文件这个时候需要修改进站和出站规则 我的修改后iptables配置文件: [root@localhost log]# cat /etc/sysconfig/iptables # Generated by iptables-save v1.4.21 on Mon Sep 3 13:04:46 2018 *filter :INPUT ACCEPT [0:0] 允许所有ip端口访问 :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :whitelist - [0:0] |
CopyRight 2018-2019 实验室设备网 版权所有 |